home *** CD-ROM | disk | FTP | other *** search
- Path: dispatch.news.demon.net!demon!redifon.demon.co.uk
- From: Guy Pickering <gp@redifon.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Wierd const problem (repost)
- Date: Fri, 22 Mar 1996 07:56:17 GMT
- Organization: Redifon MEL Ltd
- Message-ID: <827481377.25066@redifon.demon.co.uk>
- NNTP-Posting-Host: redifon.demon.co.uk
- X-NNTP-Posting-Host: redifon.demon.co.uk
- X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4c)
- MIME-Version: 1.0
- X-URL: news:comp.lang.c
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
-
- If I declare a function:
-
- void foo(const char* s)
-
- This means 's' is a pointer to a constant char. I.e. I promise not
- to modify 's' inside the function.
-
- But, how do I declare a function where 's' is a pointer to a pointer
- to a contstant char. The following doesn't work quite right:
-
- void foo(const char** s)
-
- Because when I try to pass a 'char**' info the function, the compiler
- complains about incompatible types. Is it that the const in
- 'const char**' doesn't refer to the 'char'? If so how can I declare
- what I mean?
-
- Thanks,
-
- Guy
-
- --
- Name: Guy Pickering B.Eng A.M.I.E.E
- Position: Software Engineer
- Company: Redifon MEL Ltd, Newton Rd, Crawley,
- West Sussex, RH10 2TU. ENGLAND
- Tel: +44 (0)1293 518855 Fax: +44 (0)1293 530101
- Mobile: +44 (0)973 129362 (Orange)
-
-